<template>
	<view class="main">
		<!-- 轮播图 -->
		<u-swiper imgMode="aspectFit" indicator indicatorMode="dot" indicatorInactiveColor="#8df" :autoplay="false" :list="bannerList" @change="change" @click="click">
		</u-swiper>
		<!-- 标题信息 -->
		<view class="body">
			<view class="body-title">
			{{detils.title}}
			</view>
			<view class="body-address">
				<view class="body-address-left">
					<view class="body-address-left-icon">
						<image style="width: 100%;height: 100%;" src="../../../static/feixiang/evaluate/postion@2x.png"></image>
					</view>
					<text class="body-address-address">{{detils.address}}</text>
				</view>
				<view @click="goGps" class="body-address-right">
					<image style="width: 100%;height: 100%;" src="../../../static/feixiang/icon/daohang.png"></image>
				</view>
			</view>
			<view class="body-info">
				{{detils.content}}
			</view>
		</view>
		<view class="body-doctor-title">
			机构医生
		</view>
		<view class="body-doctor-items">
			<view class="body-border" v-for="(item, index) in docterlist" :key="index">
				<view class="body-doctor-items-left">
					<image style="height: 100%;width: 100%;" :src="item.headimage | filterUrl"></image>
				</view>
				<view class="body-doctor-items-right">
					<view class="right-name">
						{{item.name}}
					</view>
					<view class="right-position">
						{{item.jobTitle}}
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import { institutionDetails } from "@/api/feixiang/application.js"
	import {imageUrl} from '@/config.js'
export default {
	data() {
		return {
			docterlist:[],  //轮播图列表
			list:[],
			agencyId:'',  //机构id
			detils:{},  //机构信息
			bannerList:[],  //轮播图片
		};
	},
	onLoad(options) {
		this.agencyId = options.agencyId
		this.initdata()
	},
	filters:{
		filterUrl(val) {
			console.log(val);
			if(val){
				return val
			} else {
				const newvav = imageUrl + '/profile/avatar/2022/12/15/dXexc760dAdOc7ebbd82c52f71226b21ec4b05cdf7b9_20221215204419A006.png'
				return newvav
			}
		}
	},
	methods: {
		// 前往导航
		goGps() {
			 wx.openLocation({
			      longitude: Number(this.detils.longitude),
			      latitude: Number(this.detils.latitude),
			      address: this.detils.address
			    }) 
		},
		async initdata() {
			const res = await institutionDetails(this.agencyId)
			console.log(res.data.detils.banner.split(','),11111);
			res.data.detils.banner.split(',').forEach(item => {
				this.bannerList.push( imageUrl + item)
			})
			// const banners = imageUrl + res.data.detils.banner
			this.detils = res.data.detils
			// res.data.list.forEach(item => {
				// item.headimage = imageUrl + item.headimage
			// })
			this.docterlist = res.data.list
			// console.log(this.bannerList,2222);
		},
		click() {},
		change() {},
	},
};
</script>

<style scoped>
	/* 轮播图样式 */
	/* >>>.u-swiper-indicator__wrapper--line__bar {
		width: 16rpx!important;
		height: 16rpx!important;
		
	}
	>>>.u-swiper-indicator__wrapper--line{
		background-color: rgba(255, 255, 255, 0.35)!important;
		height: 16rpx!important;
	} */
	
	.body {
		background-color: #fff;
		padding: 32rpx;
	}
	.body-title {
		font-size: 40rpx;
		font-weight: 600;
		margin-bottom: 12rpx;
	}
	.body-address {
		font-size: 32rpx;
		color: #777;
		margin-bottom: 20rpx;
		display: flex;
		justify-content: space-between;
	}
	.body-address-address {
		width: 560rpx;
		height: 40rpx;
		overflow: hidden;
		white-space: nowrap;
		text-overflow: ellipsis;
	}
	.body-address-left {
		display: flex;
	}
	.body-address-left-icon {
		width: 40rpx;
		height: 40rpx;
		margin-right: 10rpx;
	}
	.body-address-right {
		width: 40rpx;
		height: 40rpx;
	}
	.body-info {
		font-size: 32rpx;
		color: #777;
	}
	.body-doctor-title {
		background-color: #F7F7F7;
		height: 96rpx;
		line-height: 96rpx;
		font-size: 40rpx;
		padding: 0 32rpx;
	}
	.body-doctor-items {
		padding: 0 32rpx;
		padding-bottom: 20rpx;
	}
	.body-border {
		height: 160rpx;
		background-color: #fff;
		display: flex;
		padding-top: 32rpx;
		border-bottom: 4rpx solid #777;
	}
	.body-border:last-child {
		border-bottom: none;
	}
	.body-doctor-items-left {
		width: 96rpx;
		height: 96rpx;
		/* background-color: #8df; */
		border-radius: 50%;
		overflow: hidden;
	}
	.body-doctor-items-right {
		flex: 1;
		height: 96rpx;
		background-color: #fff;
		padding-left: 20rpx;
		display: flex;
		flex-direction: column;
		justify-content: space-between;
	}
	.right-name {
		font-size: 40rpx;
		font-weight: 600;
	}
	.right-position {
		font-size: 32rpx;
		color: #777;
	}
</style>
